package org.jeecg.modules.homeModule.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.homeModule.entity.EventEntity;
import org.jeecg.modules.homeModule.mapper.HomeExhibitionMapper;
import org.jeecg.modules.homeModule.service.HomeExhibitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class HomeExhibitionServiceImpl implements HomeExhibitionService {

    @Autowired
    HomeExhibitionMapper mapper;

    //获取订单数量
    @Override
    public int getordernumber() {

        //查询面料订单数量
        int mianliaoordernumber=mapper.getmianliaoordernumber();

        //查询个订订单数量
        int gedingordernumber=mapper.getgedingordernumber();

        //查询团订订单数量
        int teamordernumber=mapper.getteamordernumber();

        return (mianliaoordernumber+gedingordernumber+teamordernumber);
    }


    //获取售后订单数量
    @Override
    public int getafternumber() {
        return mapper.getafternumber();
    }


    //获取面料数量
    @Override
    public int getmianliaonumber() {
        return mapper.getmianliaonumber();
    }


    //查询事件记录
    @Override
    public List<EventEntity> geteventrecrodtList(int type,int begin) {
        List<EventEntity> list=mapper.geteventrecrodtList(type,begin);
        if(list!=null&&list.size()>0){
            for (int i=0;i<list.size();i++){
                list.get(i).setCreateTime(list.get(i).getCreateTime().substring(0,19));

                if(list.get(i).getStatus()==0){
                    list.get(i).setStatusString("未处理");
                }else if(list.get(i).getStatus()==2){
                    list.get(i).setStatusString("不处理");
                }
            }
        }
        return list;
    }

    //修改事件状态
    @Override
    public int updateEventstatus(String id, int status) {
        return mapper.updateEventstatus(id,status);
    }
}
